package upb.webserver.test.param;

import com.upb.webserver.common.pojo.fabric.chaincode.ReqInstantiateChainCodeVO;
import com.upb.webserver.common.pojo.fabric.chaincode.ReqSaveChainCodeVO;
import com.upb.webserver.common.pojo.rest.fabric.data.req.ReqInstantiateChainCodeDTO;
import com.upb.webserver.common.tools.JsonUtils;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class ChainCodeParamUtils {
    //-------------------------------
    //-------fabric chaincode-------
    //-------------------------------

    /**
     * ReqAddChainCodeVO
     *
     * @return example:  {"remoteContractId":1,"applicationId":1,"chaincodeContent":"asdfafafafafsdf","chaincodeName":"hello","chaincodeVersion":"v1.2"}
     */
    public static ReqSaveChainCodeVO initReqSaveChainCodeVO() {
        ReqSaveChainCodeVO param = new ReqSaveChainCodeVO();
//        param.setContractId(1); //合约id
        param.setApplicationId(69);//应用id
//        param.setChaincodeZipBase64("UEsDBBQAAAAAAPWRgVEAAAAAAAAAAAAAAAADACAAY2MvVVQNAAfP+MZfg5LNX8/4xl91eAsAAQToAwAABOgDAABQSwMEFAAAAAgA9ZGBUXlu9mGIBAAACxEAABUAIABjYy9TaW1wbGVDaGFpbmNvZGUuZ29VVA0AB8/4xl9R+cZfz/jGX3V4CwABBOgDAAAE6AMAAOVXTW/jNhA9W79iSmABqU3tTbKnADlY3WyRQ3fTpkADxMGClmmbjUyqJOWNu9j/3hlSX3Hs2I3TUwM4lkRy5s3Xe3LBs3s+E5BlUSQXhTYO4qjHpgvH8Gsm3bwc9zO9GMxXhTC5mMyEGUz52MhskGkjBtmcS5XpiRjYuVzgoWIMO84VRjttB4UQhpxYZzKtlixKomgwgGuEkYufarMgHjg9AOufQ7vg7xdCOe6kVpFDR08Oo+0yc/A1+hZF01JlEDv4fm1TApdKuti6cgwUQ79ZucZHl8oJM+UZbivG/d+ELbSyAi32MEf9KyOVy1XMxMPbE2+HJVHv8xFwM7Nwdg5ktf+zcB/QOcEcqskVN3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4/6XECb20w9QCE9MAe2D9QSwECFAMUAAAAAAD1kYFRAAAAAAAAAAAAAAAAAwAgAAAAAAAAAAAA/UEAAAAAY2MvVVQNAAfP+MZfg5LNX8/4xl91eAsAAQToAwAABOgDAABQSwECFAMUAAAACAD1kYFReW72YYgEAAALEQAAFQAgAAAAAAAAAAAAtIFBAAAAY2MvU2ltcGxlQ2hhaW5jb2RlLmdvVVQNAAfP+MZfUfnGX8/4xl91eAsAAQToAwAABOgDAABQSwECHgMUAAAACAC9voZRQGKqKqwCAACXBAAAFgAYAAAAAAABAAAAtIEcBQAAY2hhaW5jb2RlX2V4YW1wbGUwMi5nb1VUBQADlt/NX3V4CwABBOgDAAAE6AMAAFBLBQYAAAAAAwADABABAAAYCAAAAAA=");//合约内容base64
        param.setChaincodeName("testcc_zip");//合约名称
        param.setChaincodeVersion("v3.2");//合约版本
        return param;
    }


    /**
     * @return
     */
    public static ReqInstantiateChainCodeVO initReqInstantiateChainCodeVO() {
        ReqInstantiateChainCodeVO param = new ReqInstantiateChainCodeVO();
        param.setContractId(1);//contractId
        param.setInitFuncName("aa");//合约初始化方法名称
        param.setInitFunParams("a*100&b&300");//合约初始化参数
        param.setEndorsementPolicyCode(1);//背书策略（有提供接口查询背书策略的下拉列表）

        return param;
    }


    public static void main(String args[]) {
        System.out.println(JsonUtils.objToString(initReqSaveChainCodeVO()));
    }
//
//    private Integer remoteContractId;
//    @NotNull
//    private Integer applicationId;-
//    @NotBlank
//    private String chaincodeContent;
//    @NotBlank
//    private String chaincodeName;
//    @NotBlank
//    private String chaincodeVersion;
//    /**
//     * @return
//     */
//    public static ReqUpdateChainCodeVO initReqUpdateChainCodeVO() {
//        ReqUpdateChainCodeVO param = new ReqUpdateChainCodeVO();
//        param.setChainCodeId(1);
//        param.setName("hello");
//        param.setVersion("v1.2");
//        param.setLang("GO_LANG");
//        param.setInitParam(new String[]{"a", "100", "b", "300"});
//        return param;
//    }
//
//    /**
//     * ReqInstallVO
//     *
//     * @return
//     */
//    public static ReqInstallVO initReqInstallVO() {
//        ChainCodeDeployOrg chainCodeDeployOrg = new ChainCodeDeployOrg();
//        chainCodeDeployOrg.setOrgId(1);
//        chainCodeDeployOrg.setPeers(Arrays.asList(1));
//        List<ChainCodeDeployOrg> chainCodeDeployOrgList = Arrays.asList(chainCodeDeployOrg);
//
//        ReqInstallVO param = new ReqInstallVO();
//        param.setChainCodeId(1);
//        param.setChainId(1);
//        param.setChannelId(1);
//        param.setChainCodeDeployOrgList(chainCodeDeployOrgList);
//        return param;
//    }
//
//    /**
//     * ReqInstantiateVO
//     *
//     * @return
//     */
//    public static ReqInstantiateVO initReqInstantiateVO() {
//        ChainCodeDeployOrg chainCodeDeployOrg = new ChainCodeDeployOrg();
//        chainCodeDeployOrg.setOrgId(1);
//        chainCodeDeployOrg.setPeers(Arrays.asList(1));
//        List<ChainCodeDeployOrg> chainCodeDeployOrgList = Arrays.asList(chainCodeDeployOrg);
//
//        ReqInstantiateVO param = new ReqInstantiateVO();
//        param.setChainCodeId(1);
//        param.setChainId(1);
//        param.setChannelId(1);
//        param.setChainCodeDeployOrgList(chainCodeDeployOrgList);
//        param.setInitParams(new String[]{"a", "100", "b", "300"});
//        return param;
//    }
//
//    /**
//     * ReqTransactionVO
//     *
//     * @return
//     */
//    public static ReqTransactionVO initReqTransactionVO() {
//        ReqTransactionVO param = new ReqTransactionVO();
//        param.setChainCodeId("c");
//        param.setChainId(1);
//        param.setChannelId(1);
//        param.setUser("qqqqqqq");
//        param.setMethodName("invoke");
//        param.setMethodParams(new String[]{"a", "b", "3"});
//        return param;
//    }
//
//
//    /**
//     * ReqAddChainCodeFileVO
//     *
//     * @return
//     */
//    public static ReqAddChainCodeFileVO initReqAddChainCodeFileVO() {
//        ReqAddChainCodeFileVO.ChainCodeFile file = new ReqAddChainCodeFileVO.ChainCodeFile();
//        file.setName("hello");
//        file.setContentBase64("aaaaa");
//
//        ReqAddChainCodeFileVO param = new ReqAddChainCodeFileVO();
//        param.setChainCodeId(1);
//        param.setChainCodeFileList(Arrays.asList(file));
//        return param;
//    }
//
//
//    /**
//     * @return
//     */
//    public static ReqUpdateChainCodeFileVO initReqUpdateChainCodeFileVO() {
//        ReqUpdateChainCodeFileVO param = new ReqUpdateChainCodeFileVO();
//        param.setChainCodeFileId(1);
//        param.setContentBase64("aa");
//        return param;
//    }

}
